package com.cg.controller;

import com.cg.client.ItemClient;
import com.cg.dto.Dto;
import com.cg.vo.QueryItemTypeVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/p/type")
public class TypeController {

    @Resource
    private ItemClient itemClient;

    //查询分类接口
    @PostMapping("/queryItemType")
    public Dto<List<QueryItemTypeVo>> queryItemType(@RequestBody Map<String,String> map){
        String par = map.get("parent");
        //换换成Long类型的
        long parent = Long.parseLong(par);
        return itemClient.queryItemType(parent);
    }
}
